<template>
  <div class="home_box">
    <el-container>
      <!-- 左侧边栏 -->
      <el-aside width="262px">
        <h1
          style="font-size: 30px;color: #2dafcb;font-weight: bolder;margin-left: 20px;margin-top: 20px;"
        >
          HAPPY
          <br />
          <span style="color: white;">MMALL</span>
        </h1>

        <el-menu
          default-active="2"
          router
          class="el-menu-vertical-demo"
          background-color="#2dafcb"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <el-submenu index="/home">
            <template slot="title">
              <i class="el-icon-location"></i>
              <router-link to="/home" tag="span">首页</router-link>
            </template>
          </el-submenu>
          <el-submenu index="/userlist">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>用户</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/userlist">用户列表</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="/goods">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>商品</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/goods">商品管理</el-menu-item>
              <el-menu-item index="/kind">品类管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="/order">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>订单</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/order">订单管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <!-- 头部 -->
        <el-header>
          <h1 style="width:100%; height:100%; text-align:right; ">
            <span @click="show = !show">欢迎，admin</span>
          </h1>
          <p v-show="show" @click="logout" class="tp">退出登录</p>
        </el-header>
        <!-- 内容 -->
        <el-main><router-view></router-view></el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      show: false
    };
  },
  methods: {
    logout() {
      this.$router.push("/login");
    }
  }
};
</script>

<style scoped>
.home_box {
  width: 100%;
  height: 100%;
}
.el-header {
  width: 100%;
  margin: 0;
  position: relative;
}
.el-container {
  width: 100%;
  height: 100%;
}
.el-aside {
  height: 100%;
  background-color: #2b2e33;
}
.el-menu {
  border-right: none;
}
.tp {
  width: 100px;
  height: 45px;
  line-height: 45px;
  background-color: #ccc;
  position: absolute;
  top: 45px;
  right: 70px;
}
</style>
